<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Layui</title>
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="layui/css/layui.css">
  <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
  <script src="layui/layui.js"></script>
		<!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
	</head>
	<body>
		<div style="margin:0 auto;width: 70%;">

			<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
				<legend>无范围选择</legend>
			</fieldset>
			<div id="slideTest8" class="demo-slider" style="margin-top: 40px;"></div>
			<div id="test-slider-tips3" style="position:relative; left: 0px; top: 10px;"></div>


			<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
				<legend>范围选择</legend>
			</fieldset>
			<div id="slideTest9" class="demo-slider" style="margin-top: 40px;"></div>
			<div id="test-slider-tips2" style="position:relative; left: 0px; top: 10px;"></div>


		</div>


		<script src="layui/layui.js" charset="utf-8"></script>
		<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
		<script>
			layui.use('slider', function() {
				var $ = layui.$,
					slider = layui.slider;

				slider.render({
					elem: '#slideTest8',
					input: true, //输入框
					tips: true, //默认提示层
					change: function(value) {
						$('#test-slider-tips3').html('当前数值：' + value);
					}
				});
				
				slider.render({
					elem: '#slideTest9',
					value: 40 //初始值
						,
					range: true //范围选择
						,
						input: true, //输入框
						tips: true, //默认提示层
					change: function(vals) {
						$('#test-slider-tips2').html('最小值：' + vals[0] + '、最大值：' + vals[1]);
					}
				});

			});
		</script>

	</body>
</html>
